<?php
class Default_Model_DbTable_Users extends Zend_Db_Table_Abstract
{
	/*
	 * @var $_name table name : users
	 */
	protected $_name = 'users';
	
	public function findCredentials($username, $pwd)
	{
		$select = $this->select()->where('Username = ?', $username)//Cau truy van Select voi dieu kien where
								->where('Password = ?', $this->hashPassword($pwd));//Function hashPassword()phia duoi
		
		$row = $this->fetchRow($select); //Fetch ra row thoa man dieu kien truy van o tren
		if($row) {
			/*
			 * If success return the row
			 */
			return $row;
		}
		return false;
	}

	protected function hashPassword($pwd)
	{
		/*
		 * return an md5 hash
		 */
		return md5($pwd);
	}

}